package com.zhku.laosiji.service.Impl;

import com.zhku.laosiji.dao.OrdersMapper;
import com.zhku.laosiji.pojo.Orders;
import com.zhku.laosiji.service.OrderService;
import com.zhku.laosiji.vo.OrderVo;
import com.zhku.laosiji.vo.OrdersVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Jiayuan
 * @version 1.0
 * @description:
 * @time 9/11/2018 2:58 PM
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrdersMapper ordersMapper;

    @Override
    public List<OrderVo> findAll(Integer userId) {
        List<OrderVo> orders = ordersMapper.findAll(userId);
        return orders;
    }

    @Override
    public Orders selectByOrderCode(String code) {
        return ordersMapper.selectByOrderCode(code);
    }

    @Override
    public Integer finish(Orders orders) {
        int i = ordersMapper.updateByPrimaryKey(orders);
        return i;
    }

    @Override
    public int insert(Orders orders) {
        int insert = ordersMapper.insert(orders);
        return insert;
    }

    @Override
    public Integer deleteByCode(String code) {
        Integer integer = ordersMapper.deleteByCode(code);
        return integer;
    }
	
	@Override
	public List<OrdersVO> selectAllOrder() {
        return ordersMapper.selectAllOrder();
    }

	@Override
	public Integer countTotalOrder() {
		return ordersMapper.countTotalOrder();
	}

	@Override
	public int deleteByPrimaryKey(Integer id) {
		ordersMapper.deleteByPrimaryKey(id);
		return 0;
	}
	
	
}

